package router

import (
	"service/app/api"

	"github.com/gin-gonic/gin"
)

func RoleRoutesInit() {
	JoinRoutes(func(pubRoute, authRoute *gin.RouterGroup) {
		roleGroup := authRoute.Group("role")
		roleApi := api.RoleApiCreate()

		roleGroup.GET("/userid/:id", roleApi.RolesById)
		roleGroup.POST("/r-perm", roleApi.Roles_R_Perm)
		roleGroup.POST("rel-user/:id", roleApi.RolesRelation_user)
		roleGroup.GET("/users", roleApi.RoleAndUsers)
		roleGroup.GET("/current", roleApi.RoleCurrent)
		roleGroup.GET("/perm/:id", roleApi.Role_permList)
		roleGroup.PUT("/perm/:id", roleApi.RoleUpdataPerm)
		// roleGroup.GET("/byId/:id",roleApi.Roles)

		roleGroup.POST("/add", roleApi.RoleCreate)
		// bug 未知错误 与前端 "/role/","/role" 可能会引起 split错误
		roleGroup.GET("/all", roleApi.RoleList)
	})

}
